x86 Cx tracing: export expected/predicted Cx to xentrace
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 29 Jun 2009 10:00:56 +0000 (11:00 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 29 Jun 2009 10:00:56 +0000 (11:00 +0100)
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
tools/xentrace/formats
xen/arch/x86/acpi/cpu_idle.c
xen/arch/x86/acpi/cpuidle_menu.c

index 5b2a7693d1cbbceea0ea2a17631295e0560837d7..db82a09250697a9d0c514ca0ceecfc94640318c0 100644 (file)
 0x0040f10f  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  shadow_emulate_resync_only        [ gfn = 0x%(1)16x ]
 
 0x00801001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_freq_change [ %(1)dMHz -> %(2)dMHz ]
-0x00802001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_entry  [ C0 -> C%(1)d, acpi_pm_tick = %(2)d ]
+0x00802001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_entry  [ C0 -> C%(1)d, acpi_pm_tick = %(2)d, expected = %(3)dus, predicted = %(4)dus ]
 0x00802002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  cpu_idle_exit   [ C%(1)d -> C0, acpi_pm_tick = %(2)d ]
index 91f839e2649b4ecc3a41a227908479679718037c..e98ef6a6933fe9838d1362963be56b58e3d57322 100644 (file)
@@ -58,6 +58,7 @@ static void (*lapic_timer_on)(void);
 extern u32 pmtmr_ioport;
 extern void (*pm_idle) (void);
 extern void (*dead_idle) (void);
+extern void menu_get_trace_data(u32 *expected, u32 *pred);
 
 static void (*pm_idle_save) (void) __read_mostly;
 unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER - 1;
@@ -196,6 +197,7 @@ static void acpi_processor_idle(void)
     int next_state;
     int sleep_ticks = 0;
     u32 t1, t2 = 0;
+    u32 exp = 0, pred = 0;
 
     cpufreq_dbs_timer_suspend();
 
@@ -231,6 +233,7 @@ static void acpi_processor_idle(void)
             cx = power->safe_state;
         if ( cx->idx > max_cstate )
             cx = &power->states[max_cstate];
+        menu_get_trace_data(&exp, &pred);
     }
     if ( !cx )
     {
@@ -259,7 +262,7 @@ static void acpi_processor_idle(void)
             /* Get start time (ticks) */
             t1 = inl(pmtmr_ioport);
             /* Trace cpu idle entry */
-            TRACE_2D(TRC_PM_IDLE_ENTRY, cx->idx, t1);
+            TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred);
             /* Invoke C2 */
             acpi_idle_do_entry(cx);
             /* Get end time (ticks) */
@@ -315,7 +318,7 @@ static void acpi_processor_idle(void)
         /* Get start time (ticks) */
         t1 = inl(pmtmr_ioport);
         /* Trace cpu idle entry */
-        TRACE_2D(TRC_PM_IDLE_ENTRY, cx->idx, t1);
+        TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred);
         /* Invoke C3 */
         acpi_idle_do_entry(cx);
         /* Get end time (ticks) */
index 27ed7f5790126f6a6f8d1de516fd739e6ab189b7..4b284219fe63fe058d72d16f635034d4d4c55081 100644 (file)
@@ -126,3 +126,9 @@ static struct cpuidle_governor menu_governor =
 };
 
 struct cpuidle_governor *cpuidle_current_governor = &menu_governor;
+void menu_get_trace_data(u32 *expected, u32 *pred)
+{
+    struct menu_device *data = &__get_cpu_var(menu_devices);
+    *expected = data->expected_us;
+    *pred = data->predicted_us;
+}